Skip to content

ref(node): Streamline kafkajs instrumentation#21647

Merged
logaretm merged 1 commit into
developfrom
ref/streamline-kafkajs-instrumentation
Jun 19, 2026
Merged

ref(node): Streamline kafkajs instrumentation#21647
logaretm merged 1 commit into
developfrom
ref/streamline-kafkajs-instrumentation

Conversation

@logaretm

@logaretm logaretm commented Jun 18, 2026

Copy link
Copy Markdown
Member

Streamlines the vendored kafkajs instrumentation onto Sentry's span APIs.

closes #20732

Streamlines the vendored kafkajs instrumentation onto Sentry's span APIs.

Span creation moves from the OTel tracer to `startInactiveSpan`/`withActiveSpan`,
and cross-broker trace propagation now uses `getTraceData` (producer inject) and
`continueTrace` (consumer `eachMessage`) instead of the OTel propagator, so the
vendored `bufferTextMapGetter` is gone. The batch (`eachBatch`) path keeps the
upstream shape: the `poll` span is a fresh root and each processed message links
back to its producer span.

The four OTel metrics (no MeterProvider is wired up) and the `network.request`
event listeners that only fed them are dropped, along with `recordException` and
the producer/consumer hooks (origin is folded into span creation instead). Helpers
are extracted into a `utils.ts` and the now-trivial `types.ts`/`internal-types.ts`
are removed.

Adds a real error-path scenario to the integration suite asserting the producer
span is marked errored when a send fails.
@logaretm logaretm requested a review from a team as a code owner June 18, 2026 20:09
@logaretm logaretm requested review from JPeer264 and mydea and removed request for a team June 18, 2026 20:09
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.45 kB - -
@sentry/browser - with treeshaking flags 25.88 kB - -
@sentry/browser (incl. Tracing) 45.91 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.16 kB - -
@sentry/browser (incl. Tracing, Profiling) 50.69 kB - -
@sentry/browser (incl. Tracing, Replay) 85.1 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 74.71 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 89.8 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 102.47 kB - -
@sentry/browser (incl. Feedback) 44.62 kB - -
@sentry/browser (incl. sendFeedback) 32.25 kB - -
@sentry/browser (incl. FeedbackAsync) 37.38 kB - -
@sentry/browser (incl. Metrics) 28.52 kB - -
@sentry/browser (incl. Logs) 28.76 kB - -
@sentry/browser (incl. Metrics & Logs) 29.45 kB - -
@sentry/react 29.25 kB - -
@sentry/react (incl. Tracing) 48.21 kB - -
@sentry/vue 32.58 kB - -
@sentry/vue (incl. Tracing) 47.78 kB - -
@sentry/svelte 27.48 kB - -
CDN Bundle 29.86 kB - -
CDN Bundle (incl. Tracing) 48.32 kB - -
CDN Bundle (incl. Logs, Metrics) 31.4 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.62 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.71 kB - -
CDN Bundle (incl. Tracing, Replay) 85.64 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.9 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.49 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.73 kB - -
CDN Bundle - uncompressed 88.8 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.13 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 93.5 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.1 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 218.33 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.99 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268.95 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 278.69 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 282.64 kB - -
@sentry/nextjs (client) 50.61 kB - -
@sentry/sveltekit (client) 46.3 kB - -
@sentry/core/server 76.19 kB - -
@sentry/core/browser 63.34 kB - -
@sentry/node-core 61.88 kB +0.01% +1 B 🔺
@sentry/node 124 kB -0.54% -670 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 70.05 kB - -
@sentry/node/light 50.96 kB - -
@sentry/node - without tracing 74.26 kB - -
@sentry/aws-serverless 85.35 kB - -
@sentry/cloudflare (withSentry) - minified 174.55 kB - -
@sentry/cloudflare (withSentry) 436.86 kB - -

View base workflow run

@nicohrubec nicohrubec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@linear-code

linear-code Bot commented Jun 19, 2026

Copy link
Copy Markdown

JS-2384

@logaretm logaretm merged commit 3bd3135 into develop Jun 19, 2026
499 of 514 checks passed
@logaretm logaretm deleted the ref/streamline-kafkajs-instrumentation branch June 19, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streamline @opentelemetry/instrumentation-kafkajs

2 participants